package com.lianbang.pharmacy.adapter

import android.widget.TextView
import cn.ubest.mvvmcore.utils.ResourcesUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.lianbang.pharmacy.R

/**
 * Created by maoqi on 2020/11/29.
 */
class ProductCategoryListAdapter :
    BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_product_category_list) {
    var mCurSelect = 0

    override fun convert(helper: BaseViewHolder, item: String) {
        helper.setText(R.id.tv_title, item)
        if (helper.layoutPosition == mCurSelect) {
            helper
                .setTextColor(R.id.tv_title, ResourcesUtils.getColor(R.color.colorPrimary))
                .setBackgroundColor(R.id.tv_title, ResourcesUtils.getColor(R.color.white))
                .getView<TextView>(R.id.tv_title).paint.isFakeBoldText = true
        } else {
            helper
                .setTextColor(R.id.tv_title, ResourcesUtils.getColor(R.color.C_4A4A4A))
                .setBackgroundColor(R.id.tv_title, ResourcesUtils.getColor(R.color.C_F9F9F9))
                .getView<TextView>(R.id.tv_title).paint.isFakeBoldText = false
        }
    }

}